import qs from 'qs'
import request from '@/utils/request'

// 签名
import _bale from '@/utils/package'
// 获取不同的接口地址
import { ssoApi } from '@/api/index'

// 登陆
export function doLogin(params) {
  return request({
    url: ssoApi + '/login/appdoLogin',
    method: 'post',
    data: qs.stringify(_bale('appdoLogin', params))
  })
}
// 发送验证码
export function sendPhoneCode(params) {
  return request({
    url: ssoApi + '/userService/sendPhoneCode',
    method: 'post',
    data: qs.stringify(_bale('sendPhoneCode', params))
  })
}
// 验证验证码
export function validateCode(params) {
  return request({
    url: ssoApi + '/userService/validatePhoneCode',
    method: 'post',
    data: qs.stringify(_bale('validatePhoneCode', params))
  })
}
// 注册
export function registered(params) {
  return request({
    url: ssoApi + '/userService/app/register',
    method: 'post',
    data: qs.stringify(_bale('register', params))
  })
}
// 重置密码
export function resetUserPwd(params) {
  return request({
    url: ssoApi + '/userEdit/resetUserPwd',
    method: 'post',
    data: qs.stringify(_bale('resetUserPwd', params))
  })
}
// app获取用户信息
export function getUserInfo(params) {
  return request({
    url: ssoApi + '/userService/app/getUserInfo',
    method: 'post',
    loadHide: true, // 是否显示加载中
    data: qs.stringify(_bale('getUserInfo', params))
  })
}
export function getAccountInfo(params) {
  return request({
    url: ssoApi + '/userService/getAccountInfo',
    method: 'post',
    data: qs.stringify(_bale('getAccountInfo', params))
  })
}
// 用户查询企业认证信息
export function getEntAuthInfo(params) {
  return request({
    url: ssoApi + '/enterprise/getEntAuthInfo',
    method: 'post',
    data: qs.stringify(_bale('getUserInfo', params))
  })
}

// 查询余额明细
export function getwalletRecord(params) {
  return request({
    url: '/balance/getBalanceInfo',
    method: 'post',
    data: qs.stringify(_bale('getBalanceInfo', params))
  })
}

// 修改登录密码
export function updateUserPwd(params) {
  return request({
    url: ssoApi + '/userEdit/updateUserPwd',
    method: 'post',
    data: qs.stringify(_bale('updateUserPwd', params))
  })
}
// 用户设置支付密码
export function setPayPwd(params) {
  return request({
    url: ssoApi + '/userEdit/setPayPwd',
    method: 'post',
    data: qs.stringify(_bale('setPayPwd', params))
  })
}
// 修改支付密码
export function updatePayPwd(params) {
  return request({
    url: ssoApi + '/userEdit/updatePayPwd',
    method: 'post',
    data: qs.stringify(_bale('updatePayPwd', params))
  })
}
// 修改支付密码
export function updatePhone(params) {
  return request({
    url: ssoApi + '/userEdit/updateUserAccount',
    method: 'post',
    data: qs.stringify(_bale('updateUserAccount', params))
  })
}
export function updateOnlineUser(params) {
  return request({
    url: ssoApi + '/userService/app/updateOnlineUser',
    method: 'post',
    data: qs.stringify(_bale('updateOnlineUser', params))
  })
}
// 用户添加企业实名认证
export function addEntAuth(params) {
  return request({
    url: ssoApi + '/enterprise/addEntAuth',
    method: 'post',
    data: qs.stringify(_bale('addEntAuth', params))
  })
}
// 用户添加企业实名认证
export function updateEntAuthInfo(params) {
  return request({
    url: ssoApi + '/enterprise/updateEntAuthInfo',
    method: 'post',
    data: qs.stringify(_bale('updateEntAuthInfo', params))
  })
}